<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>添加用户组</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link href="../../css/demo.css" rel="stylesheet" type="text/css" />
	<script src="../../js/boot.js" type="text/javascript"></script>
	<script src="../../js/goodsClass/goodsClass.js" type="text/javascript"></script>
	<script src="../../js/swfupload/swfupload.js" type="text/javascript"></script>
    <style type="text/css">
    html, body
    {
        font-size:12px;
        padding:0;
        margin:0;
        border:0;
        height:100%;
        overflow:hidden;
    }
    </style>
</head>
<body>    
     <!-- 数据获取到以name的方式进行装载装载到相应的位置进行显示 -->
    <form id="form1" method="post"  enctype="multipart/form-data"> 
    	<input name="classId" class="mini-hidden" id="classId"/>
    	<input name="classIconTemp" class="mini-hidden" id="classIconTemp"/>
        <div style="padding-left:11px;padding-bottom:5px;" >
            <table style="table-layout:fixed;margin-top:20px;align:center">
                 <tr style="padding:10px">
                 	 
                 	<td rowspan="5"  style="padding:10px">
                 		<fieldset style="border:solid 1.2px #aaa;padding:3px;">
            			<legend >商品分类图标</legend>	
                    	<img id="classIcon" name="classIcon" src="" height="200"></img>
                    	</fieldset>
                    </td>
                    <td>商品分类名称</td>
                    <td style="padding:10px">    
                        <input name="className" required="true"  style="width:180px"  class="mini-textbox" id="className"/>
                    </td>
                    <td>商品类型</td>
                    <td style="padding:10px">    
                       <input name="classTypeId" id="classTypeId"    class="mini-combobox" style="width:180px;" textField="typeName" valueField="typeId" emptyText="请选择..."
    url="javascript:getRootPath()+'/rest/goodsType/list_for_class'"   showNullItem="true" nullItemText="请选择..."/>
                    </td>
                </tr>
                <tr style="padding:10px">
                	<td>分类排序位置</td>
                    <td style="padding:10px">    
                       <input name="classSequence" vtype="int"  style="width:180px; vtype="float" class="mini-textbox" id="classSequence"/>
                    </td>
                    <td>选择父级分类</td>
                    <td style="padding:10px">    
                       <input name="classParentId" id="classParentId"    class="mini-combobox" style="width:180px;" textField="className" valueField="classId" emptyText="请选择..."
    url="javascript:getRootPath()+'/rest/goodsClass/list_for_son'"   showNullItem="true" nullItemText="请选择..."/>
                    </td>
                </tr>
                <tr style="padding:10px">
                	<td>商品分级</td>
                    <td style="padding:10px">    
                        <input name="classLevel" required="true"  style="width:180px"  class="mini-textbox" id="classLevel" vtype="int"/>
                    </td>
                    <td>分类状态</td>
                    <td style="padding:10px">    
                        <select name="disabledState" class="mini-radiobuttonlist" id="disabledState">
                        	<option value="0">可用</option>
                        	<option value="1">禁用</option>
                    	</select>
                    </td>
                </tr>
                <tr style="padding:10px">
                	<td>是否推荐</td>
                    <td style="padding:10px">    
                        <select name="classRecommend" class="mini-radiobuttonlist" id="classRecommend">
                        	<option value="1">推荐</option>
                        	<option value="0">不推荐</option>
                    	</select>
                    </td>
                </tr>
                 <tr style="padding:10px">
                	<td>商品图标</td>
                    <td style="padding:10px">    
                       <input id="fileupload1" class="mini-fileupload" style="width:180px;" limitSize="1MB"  name="file_upload" limitType="*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.bmp;*.BMP" flashUrl="../../js/swfupload/swfupload.swf"
    onuploadsuccess="onUploadSuccess" 
    onuploaderror="onUploadError" onfileselect="onFileSelect"/>
                    </td>
                     <td style="padding:10px">    
                      <input type="button" value="上传" onclick="startUpload()"/>
                    </td>
                </tr>
            </table>
        </div>
        <div style="text-align:center;padding:20px;">               
            <a class="mini-button mini-button-primary" onclick="onOk" style="width:160px;margin-right:30px;">新增(更新)商品分类</a>       
            <a class="mini-button mini-button-primary" onclick="onCancel" style="width:160px;">取     消</a>  
        </div>        
    </form>
    <script type="text/javascript">
        mini.parse();
       	form = new mini.Form("#form1");
       	
      //动态设置url
        var fileupload = mini.get("fileupload1");
        
        var hostUrl = getRootPath();
        fileupload.setUploadUrl(hostUrl+"/rest/upload/file");

        function onFileSelect(e) {
        	
            //alert("选择文件");
        }
        function onUploadSuccess(e) {
        	
        	 var data = eval('(' + e.serverData + ')');
     		$("#classIcon").attr("src", data.errMsg);
        	var classIconTemp = mini.get("classIconTemp");
        	classIconTemp.setValue(data.errMsg);
            this.setText("");
        }
        function onUploadError(e) {
            alert("上传出错，请重试。" + e.serverData);
        }

        function startUpload() {
            var fileupload = mini.get("fileupload1");
            fileupload.startUpload();
        }
        
        function setImgShow(img_src) {
        	$("#classIcon").attr("src", img_src);
        }
       
    </script>
</body>
</html>
